package com.oracle.web;

import com.oracle.beans.*;
import com.oracle.service.CheckGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("checkGroup")
@Api(value = "检查组Controller")
public class CheckGroupController {
    @Autowired
    CheckGroupService checkGroupService;

    @GetMapping("findList")
    @ApiOperation(value = "分页查询检查组")
    public ResultInfo findList(QueryPageVo vo){
        ResultInfo  resultInfo=checkGroupService.findList(vo);
        return resultInfo;
    }
    @PostMapping("add")
    @ApiOperation(value = "添加检查组")
    public ResultInfo add(@RequestBody CheckGroupData checkGroupData){
        ResultInfo resultInfo=checkGroupService.add(checkGroupData);
        return resultInfo;
    }
    @GetMapping("checkItem/{id}")
    @ApiOperation(value = "查询检查组关联的检查项id")
    public ResultInfo findCheckItemIds(@PathVariable Integer id){
        ResultInfo resultInfo=checkGroupService.findCheckItemIds(id);
        return resultInfo;
    }
    @PutMapping("update")
    @ApiOperation(value = "修改检查组")
    public ResultInfo update(@RequestBody CheckGroupData checkGroupData){

       ResultInfo resultInfo=checkGroupService.update(checkGroupData);
       return resultInfo;
    }
    @DeleteMapping("/delete/{id}")
    @ApiOperation(value = "删除检查组")
    public ResultInfo delete(@PathVariable("id") Integer id){
       ResultInfo resultInfo=checkGroupService.delete(id);
       return resultInfo;
    }
}
